Metal Gear Conversion
From UNROM to MMC5 (from UNROM to Mapper 5)
by Dracula X

RELEASE DATE: 7-11-2021
Last Modified:	5-10-2022

MMC5 Setup is located at $3FE10

You can also use Nflate from http://www.romhacking.net/ Utilities to expand the ROM up to 512kb.

You can now use free RAM space at $5c00 to $5fff and $6000 to $7fff for cool or new stuff.

Bankswitching:
to bankswitch from $8000 - $Bfff and from $C000 - $ffff, here's how to do it:

Do this in a fixed bank:

LDA bank_number
JSR $FF40
JMP New Location

or

LDA bank_number	#$80
PHA
LDA bank_number #$00
PHA
LDA bank_number #$08
JSR $FF40
RTS



Compact Mapper makes it easier to switch banks and it is located at $D79A:

JSR Bank_08	-	$D77E
JMP New Location

JSR Bank_09	-	$D782
JMP New Location

goes up to bank $0D

Banktable is now located at $C932

Do this in $8000-$BFFF for Compact Mapper Example:
; somewhere in 8000-BFFF, bank 5
JSR to a bankswitching routine in a fixed bank

; somewhere in 8000-BFFF, bank A
RTS

; somewhere in C000-FFFF, fixed bank
; saving & restoring AXY regs may be needed
JSR switch to bank 8
JSR to RTS in bank 8 or anywhere in $8000-$BFFF
JSR switch to bank 5
+ original code from bank 5 that was replaced with your JSR
RTS

New location would be $8000 or $A000 etc... Bank 08 would be at $20010.

CHR bank 1 (Right side of PPU) is at $FF54

To switch background pages, use like so:

LDA page_number
JSR $FF54

Nametable Mapping Routine (one of its uses is mirroring) is at $FF50

To change mirroring for instance, use like so:

LDA mirroring_number (#$50 for Horizontal, #$44 for Vertical)
JSR $FF50

The setings that was at $FF00 is now at Bank 08 at $8000 Free Space
The setings that was at $FF26 is now at Bank 08 at $8027 Free Space
The setings that was at $FF32 is now at Bank 08 at $8033 Free Space
The setings that was at $D758 is now at Bank 08 at $805E More free space

Hacks supported:
All!

Hacks not Supported:
MMC1 or MMC3 Hacks!

Use Delta Patcher to patch the xdelta file to the ROM. 
Ignore the checksum and then patch the file.

Let me know if the game is not acting normal and I'll fix it. Thanks!

Credits:
Rockman: for info on how to convert the mapper!
Disch: for his mapper docs!
Shredder: for letting me use his Compact Mapper!
Cyneprepou4uk

Change Log for version 1.0.1
Reset the game is fixed.

Change Log for version 1.0.2
Added reset_stub code at $FF14.
Removed CHR bank 0.
Some other emulators but might show some garbage.

Change Log for version 1.1.0
Compact-Mapper have been added
Added two patches for Mode 1 and 3.
Patch 1 is for Mode 01.
Patch 2 is for Mode 03.

Change Log for version 1.2.0 4/29/2022
Fixed the crash while entering the password and continue the game on the game
over screen.
PRG MODE 2 have been added.
Added three patches for Mode 1, 2 and 3.
Patch 1 is for Mode 01.
Patch 2 is for Mode 02.
Patch 3 is for Mode 03.

Change Log for version 1.2.1 5/10/2022
Changed the Compact Mapper settings to the original game settings.

;----------------------------------------------------------------------
Compact Mapper manual is an example on how it works from another game.

Have fun!

Non Supported Emulators:
RockNES
VirtuaNES